home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / include / vnsaved.h < prev    next >
C/C++ Source or Header  |  1997-05-08  |  20KB  |  565 lines

  1. /*
  2.  * @(#)VNsaved.h    1.43 3/16/95 16:12:03
  3.  */
  4.  
  5. #ifndef VNSAVED_H
  6. #define VNSAVED_H
  7.  
  8. #include "VUtextarray.h"
  9.  
  10. /* IH events */
  11. #define V_DONE_EVENT         1
  12. #define V_CANCEL_EVENT       2
  13. #define V_RESTORE_EVENT      3
  14. #define V_CLEAR_EVENT        4
  15. #define V_SCROLL_EVENT       5
  16. #define V_UP_EVENT           6
  17. #define V_DOWN_EVENT         7
  18. #define V_LEFT_EVENT         8
  19. #define V_RIGHT_EVENT        9
  20. #define V_NORTH_EVENT       10
  21. #define V_SOUTH_EVENT       11
  22. #define V_EAST_EVENT        12
  23. #define V_WEST_EVENT        13
  24. #define V_NORTHEAST_EVENT   14
  25. #define V_NORTHWEST_EVENT   15
  26. #define V_SOUTHEAST_EVENT   16
  27. #define V_SOUTHWEST_EVENT   17
  28. #define V_HELP_EVENT        18
  29. #define V_COPY_EVENT        19
  30. #define V_CUT_EVENT         20
  31. #define V_PASTE_EVENT       21
  32. #define V_MODE_EVENT        22
  33. #define V_MARK_EVENT        23
  34. #define V_VSCROLL_EVENT     24
  35. #define V_HSCROLL_EVENT     25
  36. #define V_BUTTON_EVENT      26
  37. #define V_UPDATE_EVENT      27
  38. #define V_SET_HILITE_EVENT  28
  39.  
  40. /* Embedded IH actions (button, slider) */
  41. #define V_ENTER_ACT          101
  42. #define V_LEAVE_ACT          102
  43. #define V_KEYPRESS_ACT       103
  44. #define V_KEYRELEASE_ACT     104
  45. #define V_VALUECHANGE_ACT    105
  46. #define V_ACTIVATE_ACT       106
  47. #define V_DEACTIVATE_ACT     107
  48. #define V_SET_ACT            108
  49. #define V_CLEAR_ACT          109
  50.  
  51. /* Embedded input type.
  52.    If the value of parent input does not influence visibility
  53.    of the child, it is considered static, otherwise dynamic.
  54.    Static ones get setup at V_OB_EVAL_DISPLAY_ENV_SET time and
  55.    drawn at the V_OB_EVAL_DRAW_STATIC time,
  56.    Dynamic children are always setup and drawn at the 
  57.    V_OB_DRAW_DYNAMIC time.
  58.    */
  59. #define V_STATIC_CHILD         1
  60. #define V_DYNAMIC_CHILD        2
  61.  
  62. /* IH item type */
  63. #define V_TEXT_TYPE     0
  64. #define V_OBJECT_TYPE   1
  65. #define V_BUTTON_TYPE   2
  66.  
  67. #define V_DIRECT    1
  68. #define V_REVERSED -1
  69.  
  70. #define PLIST_INCR 5
  71. typedef struct
  72. {
  73.    int n;
  74.    int n_busy;
  75.    ADDRESS (*list)[];
  76. } PLIST;
  77.  
  78. typedef struct
  79. {
  80.    OBJECT object;
  81.    int inum;
  82.    int action;
  83.    int dyn_type;
  84. } CHILD;
  85.  
  86.  
  87. struct DVmessage
  88. {
  89.    int action; /* Action the embedded input provides */
  90.    int act;    /* The cause of the message */
  91.    int Ivalue;    /* Value associated with the embedded input */
  92.    double value;
  93.    double value2;
  94. };
  95.  
  96. struct Paste
  97. {
  98.    ADDRESS paste_sl;        /* Cut/paste buffer: stringlist */
  99.    int paste_width;         /* Height for RECT_MODE paste */
  100. };
  101.  
  102. struct Ed
  103. {
  104.    TA_PACKED_COLOR ed_normal_color;    /* Normal text color */
  105.    TA_PACKED_COLOR ed_reversed_color;  /* Highligted text color */
  106.    DV_BOOL ins_mode;   /* Typing mode: insert/overwrite */
  107.    DV_BOOL help_mode;  /* User have entered help_mode. Is used
  108.                on static manner.
  109.                We need this flag instead of checking
  110.                a current command handler because in
  111.                help_mode we can enter two_keys_command
  112.                mode or even marking mode. */
  113.    DV_BOOL mark_mode;  /* User have entered markind_mode.
  114.                See comments for help_mode. */
  115.    /* No two_key_command_mode flag yet because this mode ends as soon as 
  116.       you type the second (any) key. */
  117.    DV_BOOL marker;              /* Indicates if marker is on 
  118.                 (marked area was set). */
  119.    int paste_mode;           /* Indicates rectangle mode for 
  120.                 mark/cut/paste. */
  121.    struct Paste paste ;      /* Paste buffer */
  122.    TEXTARRAY ta;             /* Textarray */
  123.    TA_POSITION ta_curr_pos;  /* Current cursor position in ta */
  124.    TA_POSITION ta_mstart_pos;/* Marker start position in ta */
  125.    TA_POSITION ta_mend_pos;  /* Marker end position in ta */
  126.    short ta_height;          /* Height of textarray */
  127.    short ta_width;           /* Width of textarray */
  128.    ADDRESS sl;               /* Stringlist */
  129.    int sl_curr_row;          /* Current cursor row in sl */
  130.    int sl_curr_col;          /* Current cursor col in sl */
  131.    int sl_mstart_row;        /* Marker start row in sl.*/
  132.    int sl_mstart_col;        /* Marker start col in sl */
  133.    int sl_mend_row;          /* Marker end row in sl.*/
  134.    int sl_mend_col;          /* Marker end col in sl */
  135.    int sl_mstart_buf_row;    /* Buf. Marker start row in sl.*/
  136.    int sl_mstart_buf_col;    /* Buf. Marker start col in sl */
  137.    int anch_row;             /* Row of SL where the first row of 
  138.                 TA starts */
  139.    int anch_col;             /* Col. of Sl where the first col. of 
  140.                 TA starts */
  141.    struct Ed * ed_buf;       /* Place to save copy of curr. Ed state */
  142.    DV_BOOL (* mouse_handler)();   /* Current mouse handling func. */
  143.    DV_BOOL (* command_handler)(); /* Current command handling func. */
  144. };
  145.  
  146. typedef struct
  147.   {
  148.   DV_BOOL TooSmallToDraw;    /* Apperance: Preserving from clipping outside
  149.                  for too small object when vp's are not valid 
  150.                  after shrinking. Only outline get drawn. */
  151.   DV_BOOL UpdateTooSmall;    /* No update it update area is too small */
  152.  
  153.   double NextValue;     /* Last data value of the variable */
  154.   double CurrValue;     /* The value the variable had before 
  155.                the last value */
  156.  
  157.   OBJECT
  158.     EraseColor; /* Color to use when erasing: stroke text for
  159.            slider, slider2D or marker for slider2D,
  160.            text for VNtext, item area for toggle and button,
  161.            check area for a checklist. */
  162.  
  163.   OBJECT
  164.     Transform, /* All. Transform from layout to screen */
  165.     InObjects, /* combiner, multiplexor */
  166.     Item_deque, /* Menu, toggle, checklist */ 
  167.     Area_deque; /* Combiner, multiplexor, menu */ 
  168.  
  169.   int
  170.     TotVars, /* combiner, multiplexor, checklist */
  171.     SavedTotVars, /* combiner, multiplexor, checklist */
  172.     NumItems, /* menu, multiplexor, checklist, toggle */
  173.     CurrItemValue, /* menu, multiplexor, checklist, toggle */
  174.     NextItemValue, /* menu, multiplexor, checklist, toggle */
  175.     CurrStartIndex, /* menu, multiplexor, checklist, toggle */
  176.     NextStartIndex, /* menu, multiplexor, checklist, toggle */
  177.     InitialStartIndex, /* menu, multiplexor, checklist, toggle */
  178.     NumValues,   /* motif */
  179.     PostType,    /* All. How to post events (Object/RectEdge). */
  180.     ItemType;   /* Menu, toggle */
  181.  
  182.   char **  Items, /* motif */
  183.        * IHname, /* All */
  184.        **ItemList; /* char** for menu or toggle, OBJECT* for 
  185.               multiplexor */
  186.  
  187.   double
  188.     InitialValue; /* Saved version of original value. 
  189.              All but text, textedit */
  190.   float * Values;  /* List of values, menu, toggle */
  191.  
  192.   DV_BOOL
  193.     TemplateFlag, /* All. Template existance. */
  194.     EchoFlag, /* All. Echo as the input changes?*/
  195.     VNtype,  /* All. Template type flag. */
  196.     Poll, /* All. Trace mouse move? */
  197.     Inherit, /* combiner, multiplexor */
  198.     MoveObjects, /* Menu, multiplexor, toggle, checklist */
  199.     Scroll; /* Scrolling enabled flag for multiplexor, menu, toggle,
  200.            checklist. Flag is this a scroll bar(YES) or a slider(NO)
  201.            for a slider. */
  202.  
  203.   ADDRESS
  204.     Vdp,      /* All */
  205.     *VarList,      /* checklist, combiner, multiplexor */
  206.     *InitialList; /* combiner, multiplexor, checklist */
  207.  
  208.   double 
  209.     *OrgList, /* VNwmenu */
  210.     *OldList; /* VNwmenu */
  211.  
  212.   EVENT_REQUEST out_req, /* Event request for outside polling,
  213.                 menu, multi, button */
  214.                 in_req; /* Event request for inside polling, button */
  215.  
  216. /* Data Structure used to save VNcombine information */
  217.  
  218.  
  219. /* Data Structure used to save VNmenu/VNmultiplexor information (VNmenu.c) */
  220.   DV_BOOL
  221.     Border_flag, 
  222.     Fill_flag, 
  223.     Item_Echo, 
  224.     LastValueEcho, /* Controls update/echo logic. */
  225.     MenuAsStatus, /* Controls an initial highlight */
  226.     MenuAsSlider; /* Controls slider-like behavior */
  227.  
  228.   int
  229.     IH_type,
  230.     CurrSelValue,
  231.     NextSelValue,
  232.     NumAreas;
  233.  
  234.   DV_POINT ItemSize; /* menu, multiplexor */
  235.  
  236.   OBJECT StatusArea, /* Area to draw the last selected item for a menu
  237.                 or an input object for a multiplexor */
  238.          StatusText, /* Text to use to draw the last selected item */
  239.          LayoutArea; /* Used to determine erase color */
  240.  
  241. /* Data Structure used to save VNcheck information */
  242.   DV_BOOL CheckDraw;
  243.   OBJECT 
  244.     Check_areas,
  245.     Checkbox, 
  246.     Check;
  247.   double 
  248.     **CurrList,
  249.     **NextList,
  250.     **TempList;
  251.  
  252. /* Data Structure used to save VNpalette information */
  253.   DV_BOOL PaletteDraw; /* NO if palette area or slots are too small. */
  254.   OBJECT EchoObj,   /* Rectangle object to echo the palette color. */
  255.          Echo_color;/* Color used to echo the palette value. */
  256.   RECTANGLE Pal_vp; /* Viewport containing the palette. */
  257.   DV_POINT Slot_size;  /* The size of each color patch in the palette. */
  258.   int
  259.     color_xincr, /* The change in the color index that corresponds
  260.       | to moving from one column to the next in the palette. */
  261.     color_yincr, /* The change in the color index that corresponds
  262.       | to moving from one row to the next in the palette. */
  263.     num_columns, /* Number of columns in the palette, that is,
  264.       | the number of patches per row in the palette. */
  265.     num_rows; /* Number of rows of color patches in the palette.*/
  266.  
  267.  
  268. /* Data Structure used to save VNslider information */
  269.   RECTANGLE
  270.     DigitsBox, /* Rectangle to draw digits in */
  271.     Page, /* Scroll bar area */
  272.     NotPageMore, /* Area above page or NotSlider area  */
  273.     NotPageLess; /* Area below Page or Slider area */
  274.  
  275.   int
  276.     SliderMin, /* Minimum slider coordinate */
  277.     SliderRange, /* Amount slider top can move */
  278.     SliderDirection, /* Is this a horizontal or vertical slider? */
  279.     Anchor; /* Position around which the scrolled area is drawn */
  280.  
  281.   char
  282.     *LastValueString, /* Last value string */
  283.     *format; /* Format for displaying the data value */
  284.  
  285.   OBJECT
  286.     ValueDisplay; /* Text object giving current value of data */
  287.  
  288.   double
  289.     MinVal, /* Minimum value that the number is to have */
  290.     MaxVal, /* Maximum value that the number is to have */
  291.     IncrementVal, /* Increment to use for up and down buttons */
  292.     PageSize; /* Saved version of the initial value */
  293.  
  294.   TIC_DATA *Tdp; /* Tick Descriptor, describes where tick marks would
  295.     | be if the slider were labelled.  These tick marks are used
  296.     | to constrain the values associated with the slider.  The slider
  297.     | will have the value associated with the nearest minor tick
  298.     | mark. */
  299.  
  300.  
  301. /* Data Structure used to save VNslider2D information */
  302.  
  303. #define DIM 2      /* Slider2D number of vars */
  304.  
  305.    RECTANGLE
  306.     DigitsBox_X, /* Rectangle to draw digits of x-coordinate in */
  307.     DigitsBox_Y; /* Rectangle to draw digits of y-coordinate in */
  308.  
  309.   DV_POINT
  310.     xy,        /* New xy position picked */
  311.     XY_Max,    /* Maximum xy coordinate */
  312.     XY_Min,    /* Minimum xy coordinate */
  313.     XY_Range,    /* Amount xy can move */
  314.     SavedRasterAnchor;    /* ll corner of the raster */
  315.  
  316.   ADDRESS
  317.     SavedRaster;    /* Raster behind icon */
  318.  
  319.   LONG
  320.     EchoMarker;        /* What to echo */
  321.  
  322.   OBJECT 
  323.     TextEraseColor_X,    /* Color to use when erasing stroke text */
  324.     TextEraseColor_Y;    /* Color to use when erasing stroke text */
  325.  
  326.   DV_COORD
  327.     IconSize;    /* Size of Icon in pixels */
  328.  
  329.   double
  330.     NextXValue,     /* Last X value */
  331.     NextYValue,     /* Last Y value */
  332.     CurrXValue,     /* Last X value */
  333.     CurrYValue,     /* Last Y value */
  334.     MinX, /* Minimum value that the X number is to have */
  335.     MinY, /* Minimum value that the Y number is to have */
  336.     MaxX, /* Maximum value that the X number is to have */
  337.     MaxY, /* Maximum value that the Y number is to have */
  338.     X_Increment, /* Increment to use for up and down buttons */
  339.     Y_Increment, /* Increment to use for up and down buttons */
  340.     InitialXValue, /* Saved version of the initial value */
  341.     InitialYValue; /* Saved version of the initial value */
  342.  
  343.   char
  344.     *LastValueStringX, /* Last value string */
  345.     *LastValueStringY, /* Last value string */
  346.     *formatX, /* Format for displaying the data value */
  347.     *formatY; /* Format for displaying the data value */
  348.  
  349.   OBJECT
  350.     InvTransform,  /* xy: Transform from screen to layout */
  351.     ValueXDisplay, /* Text object giving current value of data */
  352.     ValueYDisplay, /* Text object giving current value of data */
  353.     MarkerObject,  /* Object to echo as marker in Slider2D.area */
  354.     LastXform;     /* Last xform object used to draw the marker */
  355.  
  356.   TIC_DATA *tdpX, *tdpY; /* Tick Descriptors, describe where tick marks
  357.     | would be if the slider were labelled.  These tick marks are used
  358.     | to constrain the values associated with the slider.  The slider
  359.     | will have the value associated with the nearest minor tick
  360.     | mark. */
  361.  
  362. #define vdpX vdp[0]
  363. #define vdpY vdp[1]
  364.   ADDRESS
  365.     vdp[DIM];
  366.  
  367.   int
  368.     EraseMethod;    /* How to erase icon */
  369.  
  370.   EVENT_REQUEST
  371.     poll,    /* event request to for polling */
  372.     activate,   /* event request to activate input object */
  373.     passivate,  /* event request to passivate input object */
  374.     toggle;  /* event request to toggle activation of input obj */
  375.  
  376.  
  377. /* Data Structure used to save VNtoggle information */
  378.   DV_BOOL
  379.     WrapValue, /* Default: YES, means that the data is incremented
  380.                   modulo NumItems (sawtooth function); NO means the 
  381.           data bounces between the minimum and the maximum 
  382.           (triangle func). */
  383.     GoingNext; /* YES means the data is incrementing with the picks;
  384.           NO means it is decrementing */
  385.   OBJECT Item_area;
  386.  
  387. /* Data structure used to save VNtext information */
  388.   DV_BOOL Edit_flag; /* Flag for inline editing of text */
  389.  
  390.   DV_POINT StartPoint; /* Keeps coordinates of the lower left corner of the 
  391.                character rectangle */
  392.   int
  393.     Carat_flag, /* Flag for type of carat(cursor) used to denote 
  394.            current char */
  395.     Tindex, /* String index of carat/cursor character */
  396.     Tstart,/* String index of the first displayed character of the 
  397.           string */
  398.     Tcurlen, /* Current length of the text string */
  399.     Pend_old, /* "Window" index of the previous last string character. */
  400.     Pindex_old, /* Previous position of the cursor in the "window". */
  401.     Vmaxchars, /* The maximum number of characters that will
  402.           fit in the string echo viewport */
  403.     TFcolor, TBcolor, /* Text foreground and background */ 
  404.     RedrawType; /* Depends on the type of the string change */
  405.  
  406. /* Next are used by both VNtext and VNtextedit */
  407.   DV_BOOL
  408.     Bell_flag, /* Flag for BELL when when an error is detected */
  409.     Flash_flag, /* Flag for flashing the text echo area if error */
  410.     Read_only_flag, /* Editing permission */
  411.     Direction, /* REVERSED for Arabic, hebrew, DIRECT the rest */
  412.     LocalDirection; /* To reverse direction temporarily */
  413.   
  414.   int
  415.     ChIndex, /* Character size index */
  416.     Xchsize, Ychsize, /* Character size in pixels */
  417.     TmaxlenCurr, /* Current maximum length of text string allowed */
  418.     TmaxlenNext, /* Next maximum length of text string allowed
  419.             (used with delimited text) */
  420.     TmaxlenUpdate; /* Saved maximum length 
  421.               (for delayed update after help)*/
  422.  
  423.   char 
  424.     Backspace, Deleteline, /* Terminal defined editing keys */
  425.     *InitialString, /* Copy of the string used for Restore and Cancel */
  426.     *StringCurr, /* Current data (buffer address) */
  427.     *StringNext; /* New data (pointer to the data string). To be freed
  428.             after use. */
  429.  
  430.  
  431. /* Data Structure used to save VNtextedit information */
  432.    struct Ed * ed;
  433.  
  434.    char * UpdateString, /* String used to keep the last update data at the
  435.                time update is frosen in help mode of textedit
  436.                */
  437.         *StringRestore; /* Copy of the string used to recover from restore
  438.                (repeating restore toggles text back and force)
  439.                */  
  440.    V_UTA_CURSOR_ENUM Cursor_style;
  441.    TA_PACKED_COLOR Cursor_color; 
  442.  
  443.   /* Info about the current, previous and next cursor and anchor 
  444.      positions. Is used to restore if length check fails */
  445.    int sl_curr_row,    
  446.        sl_curr_col,
  447.        anch_curr_row,
  448.        anch_curr_col,
  449.  
  450.        sl_next_row,    
  451.        sl_next_col,
  452.        anch_next_row,
  453.        anch_next_col,
  454.  
  455.        sl_old_row,    
  456.        sl_old_col,
  457.        anch_old_row,
  458.        anch_old_col;
  459.  
  460.    double Vslider_val,        /* Vert. slider value */
  461.           Vslider_val_old,    /* Last value of a vert. slider */
  462.           Hslider_val,        /* Hor. slider value */
  463.           Hslider_val_old;    /* Last value of a hor. slider */
  464.    OBJECT Vslider,
  465.           Hslider;
  466.    int ScrollOnUpdate;
  467.  
  468. /* Data Structure used to save VNnull information */
  469.  
  470.    OBJECT VarnameText;
  471.  
  472.  
  473. /* Data Structure used to save VNbutton information */
  474.  
  475. #define SD_DIM 6
  476.  
  477.   DV_BOOL EraseFlag;
  478.   ADDRESS STDTable;
  479.   OBJECT Picture[SD_DIM];
  480.   int ButtonStateNext,
  481.       ButtonStateCurr;
  482.  
  483. /* Data structure used by widgets */
  484.   ADDRESS data; /* Pointer to X menu widget */
  485.   LONG widget;  /* Top widget */
  486.   int CallbackLevel; /* Supresses recursive callbacks for widgets. */
  487.  
  488.   double
  489.     DeltaVal, /* Difference between min and max values, VNwslider */
  490.     OldValue; /* VNwslider */
  491.  
  492.   /* Embedded stuff for VNtextedit */
  493.   double Vincrement;
  494.   double Hincrement;
  495.  
  496. /***************************************************************
  497. Next up to the end of the INPUT_OBJECT_SAVED_DATA structure 
  498. is just to make build happy. Remove this when widgets get
  499. converted to a new IH tables.
  500. ****************************************************************/
  501.   RECTANGLE ClipVPused;
  502.   OBJECT it;
  503.   int LastStartIndex,
  504.       LastValue,
  505.       Tmaxlen;
  506.  
  507.   char * StringLast;
  508.  
  509.   } INPUT_OBJECT_SAVED_DATA;
  510.  
  511.  
  512. typedef struct INPUT_OBJECT_GENERIC_DATA
  513. {
  514.   RECTANGLE
  515.     WorldVP,  /* World coordinates VP for the interaction handler */
  516.     ScreenVP, /* Screen coordinates VP for the interaction handler */
  517.     VPused;   /* Actual screen viewport (drawn part of the input) 
  518.          used by the interaction handler.
  519.          This is initially set by VOinDraw and MAY BE ADJASTED 
  520.          BY AN INTERACTION HANDLER (VNmenu does it). */
  521.   ADDRESS SavedRaster; /* Address of the saved raster area */
  522.  
  523.   RECTANGLE RedrawClipVP; /* Defines the vp to redraw input in. Used 
  524.                  only by VOinRedraw/ContextRedraw. */
  525.   RECTANGLE ClipVPused;   /* Defines part of the input to draw/redraw. 
  526.                  Equels to the intersection of DI->VPused 
  527.                  and sdp->RedrawClipVP during Redraw,
  528.                  and to DI->VPused for the rest 
  529.                  (Draw & Update) */
  530.   RECTANGLE EchoVP;  /* Where the main echo is echoed. For example, 
  531.             for a slider the main echo rectangle is the
  532.             slider rectangle as oppose to echoing digits. */
  533.   DRAW_ENV de;            /* Keps draw environment used to draw inputs */
  534.   DV_BOOL did_update;        /* Is set by IH if it produced some graphical 
  535.                  output. */
  536.   V_OB_EVAL_TYPE State;   /* Indicates what the function from IH_table was
  537.                  called */
  538.   int ServiceResult;
  539.  
  540.   LONG ForeColorIndex, 
  541.        BackColorIndex; /* Color indices of foreground and background 
  542.               colors for the input object.  If these values
  543.               are V_UNDEFINED use colors from the layout. */
  544.   OBJECT ForeColor,       /* Input forecolor */
  545.          BackColor,       /* Input backcolor */
  546.          ScrForeColor, /* Color to restore to after drawing */
  547.          ScrBackColor, /* Color to restore to after drawing */
  548.          SavedForeColor, /* Saved fprecolor of the screen to restore */
  549.          SavedBackColor; /* Saved backcolor of the screen to restore */
  550.  
  551.   /* Embedded stuff */
  552.   OBJECT parent;
  553.   struct DVmessage message;
  554.   DV_BOOL SuppressVupdate;
  555.   DV_BOOL SuppressHupdate;
  556.   double Value; 
  557.   
  558.   int Rvalue; /* The last return value: 
  559.          used for chaining service results */
  560.  
  561.   OBJECT ActiveChildrenList;
  562.   } INPUT_OBJECT_GENERIC_DATA;
  563.  
  564. #endif /* VNSAVED_H */
  565.